<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"
   xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:ba="http://benimasyam.bankasya.com/tags">
<ui:composition template="/template.xhtml">
   <ui:define name="content">
      <script type="text/javascript">
            function validate(){
               var oldpass =$("#bodyForm\\:keyword").val();
               if(oldpass.length == 0){
                  showAlert("#{messages.JS_ESKIPAROLA_BOS}");                
                  return false;
               }
               var newpass = $("#bodyForm\\:newKeyword").val();
               var newpassRetype = $("#bodyForm\\:newKeywordRetype").val();
               if(newpass.length == 0 || newpassRetype.length == 0){
                  showAlert("#{messages.JS_YENIPAROLA_BOS}");
                  return false;
               }
               if(newpass != newpassRetype){
                  showAlert("#{messages.JS_PAROLALARFARKLI}");
                  return false;
               }
               return true;
            }
         
            function turkceKarakterKontrol(yeniSifre,whichNewKeyword){
               var length1=yeniSifre.value.length;
         
               yeniSifre.value = yeniSifre.value.replace(/[^A-Za-z0-9' '!#$+%&amp;/&#40;&#41;=&#123;&#125;?\\*-:;.,@&lt;&gt;]/g, '');
         
               //girilen yeni sifrede turkce karakter varsa silinir,boylece uzunluk 1 azalir
               //Yani length1>length2 ise turkce karakter girilmis demektir.
               var length2=yeniSifre.value.length;
         
               if(length1>length2){ 
                  alert("#{sifrebundle.cok_aciklama_sifreturkcekarakter}");
         
                  if(whichNewKeyword==1){
                     $("#bodyForm\\:newKeyword").val("");
                     $("#bodyForm\\:newKeyword").focus();
                  }
         
                  if(whichNewKeyword==2){
                     $("#bodyForm\\:newKeywordRetype").val("");
                     $("#bodyForm\\:newKeywordRetype").focus();
                  }
               }
            }
      </script>
         <p>
            <h:outputFormat value="#{sifrebundle.cok_aciklama_hepsi}">
               <f:param value="#{sifreDegistirBean.keywordMinLength}" />
               <f:param value="#{sifreDegistirBean.keywordMaxLength}" />
            </h:outputFormat>
         </p>
         
         <p:panel id="parolaDegistirPanel" header="#{sifrebundle.cok_baslik}" styleClass="marginTop15">
         	<h:outputScript library="js" name="document_ready.js" />
            <p:panelGrid columns="2" styleClass="zebra" columnClasses="startCol1,startCol2">
               <h:outputText value="#{sifrebundle.cok_keyword}" />
               <p:password id="keyword" value="#{sifreDegistirBean.keyword}" style="width:130px;" styleClass="inputPass"
                  maxlength="#{sifreDegistirBean.keywordMaxLength}" autocomplete="off" />

               <h:outputText value="#{sifrebundle.cok_new_keyword}" />
               <p:password styleClass="inputPass" id="newKeyword" label="#{sifrebundle.cok_new_keyword}" feedback="true"
                  promptLabel="#{sifrebundle.new_keyword_prompt}" value="#{sifreDegistirBean.newKeyword}" style="width:130px"
                  autocomplete="off" weakLabel="#{sifrebundle.new_keyword_weakLabel}" goodLabel="#{sifrebundle.new_keyword_goodLabel}" strongLabel="#{sifrebundle.new_keyword_strongLabel}"
                  onkeyup="turkceKarakterKontrol(this,1);"
                  onfocus="turkceKarakterKontrol(this,1);MP.getFocus(this.id,#{sifreDegistirBean.keywordMaxLength},2);MP.show();"
                  maxlength="#{sifreDegistirBean.keywordMaxLength}"/>

               <h:outputText value="#{sifrebundle.cok_new_keyword_retype}" />
               <p:password styleClass="inputPass" id="newKeywordRetype" label="#{sifrebundle.cok_new_keyword_retype}"
                  feedback="true" weakLabel="#{sifrebundle.new_keyword_weakLabel}" goodLabel="#{sifrebundle.new_keyword_goodLabel}" strongLabel="#{sifrebundle.new_keyword_strongLabel}"
                  promptLabel="#{sifrebundle.new_rekeyword_prompt}"
                  onkeyup="turkceKarakterKontrol(this,2);karakterSayisiKontrol(this,2)"
                  onfocus="turkceKarakterKontrol(this,2);MP.getFocus(this.id,#{sifreDegistirBean.keywordMaxLength},2);MP.show();"
                  autocomplete="off"
                  value="#{sifreDegistirBean.newKeywordRetype}" style="width:130px"
                  maxlength="#{sifreDegistirBean.keywordMaxLength}" />
            </p:panelGrid>
         </p:panel>
         
         <div class="btnRight marginTop7">
            <p:commandButton id="actionButton" value="Tamam" styleClass="btn100"
               action="#{sifreDegistirBean.saveAction()}"  onclick="validate()" update="@form"/>
         </div>
   </ui:define>
</ui:composition>
</html>

